<template>
  <div class="cinema-info">
    <nav-bar class="nav-border">
      <p slot="left" class="titleLeft" @click="goBack">
        <img src="~assets/img/zuojiantou.png" alt="" class="backImg" />
      </p>
    </nav-bar>
    <div class="main-info">
      <h1 class="cinemaName">{{ cinemaInfo.name }}</h1>
      <div class="address-phone">
        <span class="iconfont icon-dizhi"></span>
        <span class="center">{{ cinemaInfo.address }}</span>
        <span class="iconfont icon-jiantou"></span>
      </div>
      <div class="address-phone">
        <span class="iconfont icon-dianhua"></span>
        <span class="center">{{ cinemaInfo.phone }}</span>
        <span class="iconfont icon-jiantou"></span>
      </div>
      <service-info :services="cinemaInfo.services" class="service-info" />
    </div>
  </div>
</template>

<script>
import { mapMutations } from 'vuex'
import { cinemaInfo } from '@/network/cinema'
import ServiceInfo from './detailChildren/ServiceInfo.vue'
export default {
  components: { ServiceInfo },
  name: 'CinemaInfo',
  data() {
    return {
      cinemaInfo: []
    }
  },
  created() {
    this.tabBarHide()
    this.getCinemaInfo()
  },
  methods: {
    ...mapMutations(['tabBarShow', 'tabBarHide']),
    goBack() {
      this.$router.back()
    },
    async getCinemaInfo() {
      const { data: res } = await cinemaInfo(this.$route.params.id)
      this.cinemaInfo = res.cinema
    }
  },

  beforeDestroy() {
    this.tabBarShow()
  }
}
</script>

<style lang="scss" scoped>
.cinema-info {
  position: relative;
  top: 0;
  left: 0;
  .nav-border {
    border: none !important;
  }
  .main-info {
    height: calc(100vh - 0.44rem);
    padding: 0 0.15rem 0.44rem 0.15rem;
    background-color: #fff;
    .cinemaName {
      font-size: 17px;
      color: #191a1b;
      text-align: center;
      font-weight: 400;
      padding-top: 0.1rem;
      padding-bottom: 0.25rem;
      border-bottom: 0.5px solid #eee;
    }
    .address-phone {
      display: flex;
      justify-content: space-between;
      padding: 0.15rem 0.075rem;
      border-bottom: 0.5px solid #eee;
      align-items: center;

      .iconfont {
        font-size: 0.2rem;
      }
      .center {
        flex: 1;
        font-size: 0.14rem;
        margin-left: 0.15rem;
        overflow: hidden;
        text-overflow: hidden;
        white-space: nowrap;
      }
      .icon-jiantou {
        font-size: 0.14rem;
        transform: scale(0.5);
      }
    }
  }
}
.titleLeft {
  img {
    height: 0.3rem;
    width: 0.3rem;
  }
}
::v-deep.service-info {
  padding: 0 !important;
}
</style>